<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="../js/jquery.min.js"></script>
</head>

<body style="font-family:verdana;color:#006400;font-size:20px;font-weight:bold">
	添加用户信息
	<s:form action="addUserAction" namespace="/" name="a"
		id="a" onsubmit="return CheckForm()">
		<!-- 		<s:textfield name="userinfo.department.depId" label="部门编号"/> -->
		<s:textfield name="users.password" label="密码" id="userpsd" />
		<s:textfield name="users.duty" label="职务" />
		<s:textfield name="users.department" label="部门" />
		<s:textfield name="users.employeeNumber" label="员工编号" />
		<s:submit value="保存" method="add" />
	</s:form>
	
	<script type="text/javascript">
	function CheckForm() {
		if (document.a.userpsd.value.trim() == "") {
			alert("密码不能为空!");
			document.a.userid.focus();
			return false;
		}
		return true;
	}
	
	$('#userid').blur(function() {
		var uid = document.getElementById("userid").value;
		$.ajax({
			url : "../action/checkUserIdAction?uid_ajax=" + uid,
			async : false,
			success : function(result) {
				if (result != "success") {
					alert("该用户已存在，请重新输入");
					document.getElementById("userid").value = "";
				}
			},
// 			error:function(){
//	   			alert(window.location.href);
// 	   			alert("error");
// 	   		},
		});
	});
</script>
</body>
</html>